-
Notifications
You must be signed in to change notification settings - Fork 763
Implement tom-select for related documents #6610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Implement tom-select for related documents #6610
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements Tom Select for improved related documents management while adding filtering to exclude the current and restricted documents.
- Replaces the old checkbox list with a Tom Select based search input on edit and new document pages.
- Updates search queries and results to include document IDs and the is_restricted flag.
- Introduces the is_restricted field in the search index for documents.
Reviewed Changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
File | Description |
---|---|
kitsune/sumo/static/sumo/js/wiki_search.js | Refactors the UI to integrate Tom Select and filters documents based on current document and is_restricted status. |
kitsune/search/search.py | Propagates the is_restricted flag in the search result. |
kitsune/search/documents.py | Adds a new Boolean is_restricted field and its preparation method for documents. |
Files not reviewed (2)
- kitsune/sumo/static/sumo/scss/components/_wiki.scss: Language not supported
- kitsune/wiki/jinja2/wiki/includes/related_docs_widget.html: Language not supported
Comments suppressed due to low confidence (1)
kitsune/sumo/static/sumo/js/wiki_search.js:75
- Consider ensuring that both item.id and currentDocId have consistent types by converting them (for example, using parseInt) and using strict equality (!==) to avoid potential type coercion issues.
.filter(item => !currentDocId || item.id != currentDocId)
97e81f3
to
6a0a03d
Compare
6a0a03d
to
98bb364
Compare
- Don't allow addition of article to it's own related - Don't show old checkbox list on edit or new document pages - Exclude restricted documents from viewing in related documents section of article page
98bb364
to
c37c0bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 4 changed files in this pull request and generated no comments.
Files not reviewed (3)
- kitsune/sumo/static/sumo/scss/components/_wiki.scss: Language not supported
- kitsune/wiki/jinja2/wiki/includes/document_macros.html: Language not supported
- kitsune/wiki/jinja2/wiki/includes/related_docs_widget.html: Language not supported
Comments suppressed due to low confidence (1)
kitsune/sumo/static/sumo/js/wiki_search.js:87
- The render.item function both appends the rendered template to $relatedDocsList and returns an HTML string, which might result in duplicate rendering of the same item. Consider removing the side-effect append so that rendering is handled solely by the return value.
$relatedDocsList.append(nunjucksEnv.render('wiki-related-doc.njk', context));
This should fix 2259, 2260, 2261